/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.sun.courier.view;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/**
 *
 * @author HONG QUAN
 */

public class Receiving_Returning extends JFrame{
    JPanel controlPanel;
    JLabel lblReceiver = new JLabel("Receiver Name");//Cai nay tu dong hien khi dang nhap. Phu thuoc vao vi tri neu la nhan vien neu chi co 1 chuc nang hoac nhan hang hoac tra hang thi hien thi 1 chuc nang
    JLabel lblCourierName = new JLabel("Courier Name");
    JLabel lblCustomerName = new JLabel("Customer Name");
    JLabel lblPhone = new JLabel("Phone");
    JLabel lblStatus = new JLabel("Status");// Gui hang hoac tra hang
    JLabel lblWeight = new JLabel("Weight");
    JLabel lblDepartLocation = new JLabel("Departed Location");
    JLabel lblDestination = new JLabel("Destination");
    JLabel lblDistance = new JLabel("Distance");
    JLabel lblDescription = new JLabel("Description");
    JLabel lblPrice = new JLabel("Price");

    JTextField txtReceiver = new JTextField();
    JTextField txtCourierName = new JTextField();
    JTextField txtCustomerName = new JTextField();
    JTextField txtPhone = new JTextField();
    JTextField txtStatus = new JTextField();
    JTextField txtWeight = new JTextField();
    JTextField txtDepartLocation = new JTextField();
    JTextField txtDestination = new JTextField();
    JTextField txtDistance = new JTextField();
    JTextArea txtDescription = new JTextArea();
    JTextField txtPrice = new JTextField();
    
    JButton btnAccept = new JButton("Accept");
    JButton btnReset = new JButton("Reset");
    
    public Receiving_Returning() {
        try {
            initComponents();
        } catch (Exception ex) {
            Logger.getLogger(CourierReceivingReturning.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void initComponents() throws Exception {
        setLayout(new BorderLayout());
        controlPanel = createControlPanel();
        add(controlPanel, BorderLayout.NORTH);
    }

    protected JPanel createControlPanel() {
        JPanel ctrPanel = new JPanel();
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        ctrPanel.setLayout(gridbag);

        c.gridx = 0;
        c.gridy = 1;
        c.gridheight = 1;
        c.insets = new Insets(5, 3, 3, 3);
        c.anchor = GridBagConstraints.SOUTHWEST;
        ctrPanel.add(lblReceiver, c);

        c.gridx = 1;
        c.gridy = 1;
        c.gridheight = 1;
        c.insets = new Insets(5, 3, 0, 3);
        c.anchor = GridBagConstraints.SOUTHWEST;
        txtReceiver.setPreferredSize(new Dimension(300, 30));
        txtReceiver.setEditable(false);
        ctrPanel.add(txtReceiver, c);// Danh cho nhan vien khi dang nhap ten se tu dong hien len.

        c.gridx = 0;
        c.gridy = 2;
        ctrPanel.add(lblCourierName, c);

        c.gridx = 1;
        c.gridy = 2;
        txtCourierName.setPreferredSize(new Dimension(300, 30));
        ctrPanel.add(txtCourierName, c);

        c.gridx = 0;
        c.gridy = 3;
        ctrPanel.add(lblCustomerName, c);

        c.gridx = 1;
        c.gridy = 3;
        txtCustomerName.setPreferredSize(new Dimension(300, 30));
        ctrPanel.add(txtCustomerName, c);

        c.gridx = 0;
        c.gridy = 4;
        ctrPanel.add(lblPhone, c);

        c.gridx = 1;
        c.gridy = 4;
        txtPhone.setPreferredSize(new Dimension(300, 30));
        ctrPanel.add(txtPhone, c);

        c.gridx = 0;
        c.gridy = 5;
        ctrPanel.add(lblStatus, c);

        c.gridx = 1;
        c.gridy = 5;
        txtStatus.setText("Receive Courier");
        txtStatus.setEditable(false);
        txtStatus.setPreferredSize(new Dimension(300, 30));
        ctrPanel.add(txtStatus, c);// Tu day tro ve truoc danh cho khach hang den gui hang

        c.gridx = 0;// Tu day tro ve sau chi danh cho khach hang den gui hang
        c.gridy = 6;
        ctrPanel.add(lblWeight, c);

        c.gridx = 1;
        c.gridy = 6;
        txtWeight.setPreferredSize(new Dimension(300, 30));
        ctrPanel.add(txtWeight, c);

        c.gridx = 0;
        c.gridy = 7;
        ctrPanel.add(lblDepartLocation, c);

        c.gridx = 1;
        c.gridy = 7;
        txtDepartLocation.setPreferredSize(new Dimension(300, 30));
        ctrPanel.add(txtDepartLocation, c);

        c.gridx = 0;
        c.gridy = 8;
        ctrPanel.add(lblDestination, c);

        c.gridx = 1;
        c.gridy = 8;        
        txtDestination.setPreferredSize(new Dimension(300, 30));
        ctrPanel.add(txtDestination, c);

        c.gridx = 0;
        c.gridy = 9;
        ctrPanel.add(lblDistance, c);
        c.gridx = 1;
        c.gridy = 9;
        txtDistance.setPreferredSize(new Dimension(300, 30));
        ctrPanel.add(txtDistance, c);

        c.gridx = 0;
        c.gridy = 10;
        c.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
        ctrPanel.add(lblDescription, c);
        c.gridx = 1;
        c.gridy = 10;
        txtDescription.setBorder(BorderFactory.createLineBorder(Color.GRAY));
        txtDescription.setPreferredSize(new Dimension(300, 90));
        ctrPanel.add(txtDescription, c);

        c.gridx = 0;
        c.gridy = 11;
        ctrPanel.add(lblPrice, c);
        c.gridx = 1;
        c.gridy = 11;
        txtPrice.setEditable(false);
        txtPrice.setPreferredSize(new Dimension(300, 30));// Gia tu load khi nhap khoang cach
        ctrPanel.add(txtPrice, c);

        c.gridx = 1;
        c.gridy = 12;
        c.anchor = GridBagConstraints.EAST;
        JPanel pnBtn = new JPanel();
        pnBtn.setLayout(new FlowLayout());
        pnBtn.add(btnAccept);
        pnBtn.add(btnReset);
        ctrPanel.add(pnBtn, c);
        
        return ctrPanel;
    }
    
    public static void main(String[] args) throws Exception {
        Receiving_Returning f = new Receiving_Returning();
        
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(new Dimension(700, 500));
        f.setVisible(true);
    }
}
